package kgc.qy.controller;

import kgc.qy.pojo.Patient;
import kgc.qy.service.IPatientService;
import kgc.qy.util.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping(value = "pat")
@CrossOrigin
/*就诊信息管理*/
public class PatientController {
    @Autowired
    private IPatientService iPatientService;

    @PostMapping(value = "selectPat")
    public CommonResult selectPat(@RequestParam(value = "id",required = false) Long id,
                                  @RequestParam(value = "name",required = false) String name){
        System.out.println(id);
        System.out.println(name);
        List<Patient> patients = iPatientService.selectAllPatient(id, name);
        System.out.println(patients);
        return new CommonResult(200,"查询成功",patients);
    }
}
